Skip to content

feat: scaffold transaction presentation in bdk_demo active wallet flow#62

Open
j-kon wants to merge 8 commits intobitcoindevkit:mainfrom
j-kon:feat/bdk-demo-transaction-scaffold
Open

feat: scaffold transaction presentation in bdk_demo active wallet flow#62
j-kon wants to merge 8 commits intobitcoindevkit:mainfrom
j-kon:feat/bdk-demo-transaction-scaffold

Conversation

@j-kon
Copy link
Copy Markdown
Contributor

@j-kon j-kon commented Mar 23, 2026

Summary

Adds a transaction detail flow to the reference wallet scaffold.

What changed

  • enabled navigation from transaction list to a transaction detail page
  • added TransactionDetailPage to display:
    • full txid
    • amount
    • status
    • block height
    • timestamp
  • introduced WalletService.loadTransactionByTxid
  • made transaction rows tappable using Material/InkWell
  • refactored widget tests with FakeWalletService
  • added tests for:
    • navigation to detail page
    • correct transaction rendering
    • handling missing transactions gracefully

Notes

  • uses placeholder transaction data
  • structured for future real wallet/BDK integration

@reez
Copy link
Copy Markdown
Collaborator

reez commented Mar 23, 2026

@Johnosezele cc

@reez
Copy link
Copy Markdown
Collaborator

reez commented Mar 24, 2026

Nice improvement to the demo flow and the widget coverage is solid.

I found one correctness issue before approval: TransactionDetailPage caches its future in initState, but go_router keys matched pages by the route pattern, so changing /transactions/:txid can reuse the same State and leave the screen showing the old transaction. Once that lifecycle case is handled, this is looking pretty good to merge.

@j-kon
Copy link
Copy Markdown
Contributor Author

j-kon commented Mar 24, 2026

Nice improvement to the demo flow and the widget coverage is solid.

I found one correctness issue before approval: TransactionDetailPage caches its future in initState, but go_router keys matched pages by the route pattern, so changing /transactions/:txid can reuse the same State and leave the screen showing the old transaction. Once that lifecycle case is handled, this is looking pretty good to merge.

Good catch, that makes sense.

I’ll update the page to handle route changes properly instead of caching in initState.

@j-kon
Copy link
Copy Markdown
Contributor Author

j-kon commented Mar 24, 2026

Good catch on that — makes sense.

I’ve fixed it by refreshing the cached future in didUpdateWidget whenever the txid changes, so the page no longer shows stale transaction data when the route is reused.

Also added a widget test to cover this exact case (same page instance, different txid).

Everything’s passing on my end. Happy to adjust if you prefer a different approach.

CC @reez

Copy link
Copy Markdown
Contributor

@Johnosezele Johnosezele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on! Great changes in the UI side of things.

I recognize this as a scaffold pr but I think there's some mixup from the ground up

You're not fetching transaction details from CanonicalTx of bdk.dart where sent/received come from wallet.sentAndReceived().

For your changes on the wallet_service.dart file, you are mostly return hardcoded placeholder data, you're not making use of our bdk.dart bindings api, I can't see any of the related methods, can you take a look at this commit. By extension this has a huge impact on wallet_providers.dart

For the test section of your PR, We'd need to structure /bdk_demo/test because as our test suite grows things may begin to look tightly coupled, part of what I did in the /test section of this commit which is still draft.

@reez pls can you hold off on merging this just yet, there seem to be alot of parallel implementation conflict as this is a scaffold pr, it would need to be rebased due to lots of conflicting changes with [this](https://github.com/bitcoindevkit/bdk-dart/pull/61)

Comment thread bdk_demo/README.md Outdated
Comment thread bdk_demo/README.md Outdated
Comment thread bdk_demo/lib/features/wallet_setup/transaction_detail_page.dart Outdated
Comment thread bdk_demo/lib/features/wallet_setup/active_wallets_page.dart
Comment thread bdk_demo/lib/models/tx_details.dart Outdated
Comment thread bdk_demo/lib/features/wallet_setup/transaction_detail_page.dart Outdated
Comment thread bdk_demo/lib/features/wallet_setup/active_wallets_page.dart Outdated
@j-kon
Copy link
Copy Markdown
Contributor Author

j-kon commented Mar 25, 2026

Thanks a lot for the detailed review — this really helps.

I see what you mean about the mixup with using placeholder data instead of wiring through the bdk.dart APIs, and also the structure concerns around the demo/tests.

I’ll take a step back and align this properly with the existing architecture, rework the service layer to use CanonicalTx / wallet APIs, and clean up the structure as suggested.

Also noted on the README and shared widgets — I’ll split those changes out and refactor accordingly.

Appreciate the guidance here 🙏

@reez
Copy link
Copy Markdown
Collaborator

reez commented Apr 7, 2026

merged #61 so can rebase this branch

@j-kon j-kon force-pushed the feat/bdk-demo-transaction-scaffold branch from 2d3e933 to bebb956 Compare April 14, 2026 13:00
@j-kon
Copy link
Copy Markdown
Contributor Author

j-kon commented Apr 14, 2026

merged #61 so can rebase this branch

Thanks, I’ve now rebased this branch.

@reez
Copy link
Copy Markdown
Collaborator

reez commented Apr 14, 2026

merged #61 so can rebase this branch

Thanks, I’ve now rebased this branch.

Cool I'll let John take a look to see if all his comments are resolved 👍

Copy link
Copy Markdown
Contributor

@Johnosezele Johnosezele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect the Transaction flow to exist as a separate feature module, instead of being implemented by repurposing ActiveWalletsPage / wallet_setup to act like a “reference scaffold”.

I’d expect something closer to:

  • features/transactions/
    • transactions_list_page.dart
    • transaction_detail_page.dart
    • transactions_controller.dart (Riverpod Notifier)
    • transactions_repository.dart (interface)
  • services/ stays focused on actual wallet / persistence concerns (WalletService, StorageService, etc.)
  • any placeholder/demo data should live behind a demo TransactionsRepository (or fake) rather than inside WalletService.

Thanks for adding coverage, the widget tests are valuable (esp. the tx detail route reuse / txid refresh case).
That said, this PR still doesn’t really follow the earlier direction about keeping /bdk_demo/test structured as it grows (to avoid tightly-coupled test files and to keep helpers reusable).

I can see that FakeWalletService + placeholder transaction fixtures are defined inside app_shell_test.dart, and similar fixtures appear again in active_wallets_page_test.dart.

In the end, something like this is ideal:

  • test/presentation/transactions/transaction_detail_page_test.dart
  • test/presentation/wallet_setup/reference_wallet_scaffold_page_test.dart (or wherever this flow lands)
  • test/helpers/fakes/fake_wallet_service.dart
  • test/helpers/fixtures/placeholder_transactions.dart

This way tests remain feature-scoped, helpers are shared, and future PRs can add coverage without growing single files indefinitely.

Comment thread bdk_demo/lib/features/wallet_setup/active_wallets_page.dart
Comment thread bdk_demo/lib/services/wallet_service.dart
Comment thread bdk_demo/lib/services/wallet_service.dart Outdated
Comment thread bdk_demo/lib/features/transactions/models/demo_tx_details.dart
Comment thread bdk_demo/test/presentation/active_wallets_page_test.dart
Comment thread bdk_demo/test/presentation/app_shell_test.dart
@j-kon
Copy link
Copy Markdown
Contributor Author

j-kon commented Apr 19, 2026

Thanks @Johnosezele, this is clear.

I see the core issue now: the transaction scaffold should be introduced as its own feature module instead of being layered onto ActiveWalletsPage and WalletService.

I’m going to refactor this in that direction by:

  • restoring ActiveWalletsPage to its original behavior
  • moving the scaffold UI into a standalone transactions feature
  • keeping demo transaction data behind a demo repository
  • restoring WalletService to a strict contract
  • renaming the app-side transaction model to avoid the hide TxDetails pattern
  • removing balanceDelta so net amount is always derived from received - sent
  • splitting the tests so active-wallet coverage stays intact and transaction tests move out of app_shell_test.dart

Thanks for the detailed review.

@Johnosezele
Copy link
Copy Markdown
Contributor

Maybe in the future try to create a commit per fix, its easier to review that way. I can see all of my comments marked as resolved but its hard to track which is which from the diff in your recent commit.
Thanks again.

@j-kon
Copy link
Copy Markdown
Contributor Author

j-kon commented Apr 19, 2026

Thanks.

I agree the last refactor landed as a larger commit than ideal. I’ll keep future follow-up work split into smaller fix-by-fix commits so it’s easier to review and map comments back to changes.

Appreciate the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants